/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package models.monorent;

import java.lang.reflect.*;
import com.google.gson.*;

public class RentInfoSerializer implements JsonSerializer<RentInfo> {

	public JsonElement serialize(RentInfo ri, Type typeOfUser, JsonSerializationContext context) {
		JsonObject obj = new JsonObject();
		
		obj.addProperty("id", ri.id);
		obj.addProperty("name", ri.name);
		obj.addProperty("loc", ri.location);
		obj.addProperty("lat", ri.lat);
		obj.addProperty("lng", ri.lng);
		obj.addProperty("bed", ri.bedroomCount);
		obj.addProperty("bath", ri.bathroomCount);
		obj.addProperty("pets", ri.petsAllowed);
		obj.addProperty("fur", ri.furnitured);
		obj.addProperty("desc", ri.description);
		obj.addProperty("date", ri.createDate.toString());
		obj.addProperty("owner", ri.owner.id);
        obj.addProperty("price", ri.price);
        obj.addProperty("images", ri.images.size());
		
		return obj;
	}
}